<template>
  <n-button v-if="renderIcon" v-bind="$attrs" :render-icon="renderIcon">
    <slot />
  </n-button>
  <n-button v-bind="$attrs" v-else>
    <slot />
  </n-button>
</template>

<script setup lang="tsx">
import type { VNodeChild } from 'vue';
import type { CButtonProps } from '../index'
const props = defineProps<CButtonProps>();
const Icons = await import('@vicons/material');
const Icon = Icons[props.iconName!];
const renderIcon = Icon ? () => <n-icon><Icon /></n-icon> as VNodeChild : null; 
</script>